home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games Extra 1996 September / Amiga Games Extra CD-ROM 9-1996.iso / userbox / publicdomain / fastimagefxmodules / convertanim.rx < prev    next >
Text File  |  1995-12-10  |  2KB  |  83 lines

  1. /* ConvertAnim.rx © by Helmut Hoffmann 1995 */
  2. /* Make HHsYUVSq animation from another animation format */
  3. /* with ImageFX or EGSImageFX */
  4.  
  5. OPTIONS RESULTS
  6.  
  7. CLOSE(STDERR)
  8. win=OPEN(STDERR,'NIL:')
  9.  
  10. if ~(ADDRESS()='REXX') then do
  11.   CLOSE(STDOUT)
  12.   win=OPEN(STDOUT,'CON:0/50//130/ConvertAnim.rx/CLOSE')
  13.   win=OPEN(STDERR,'NIL:')
  14.   end
  15. else do
  16.   if ~SHOW('p','IMAGEFX.1') then do
  17.     if ~SHOW('p','EGS_IMAGEFX.1') then do
  18.       say "This script needs a running ImageFX or EGSImageFX"
  19.       say "and HHsFastIFXModules (the saver) to convert animations"
  20.       exit
  21.       end
  22.     else ifxport='EGS_IMAGEFX.1'
  23.     end
  24.   else ifxport='IMAGEFX.1'
  25.   address value ifxport
  26. end
  27.  
  28. 'GetPrefs LoadPath'
  29. LoadPath=result
  30. 'GetPrefs SavePath'
  31. SavePath=result
  32.  
  33. address command 'requestfile drawer "'LoadPath'" noicons title "Select source animation:" >ENV:HHsYUVAnimSource'
  34. if rc~=0 then exit
  35. address command 'requestfile drawer "'SavePath'" savemode noicons pattern ~(#?.info) title "Select destination animation file:" >ENV:HHsYUVAnimFile'
  36. if rc~=0 then exit
  37.  
  38. if (open(SourceList,'ENV:HHsYUVAnimSource','READ')=0) then do
  39.    say "Can't read source file name"
  40.    exit
  41. end
  42. if (open(DestList,'ENV:HHsYUVAnimFile','READ')=0) then do
  43.    say "Can't read dest file name"
  44.    exit
  45. end
  46.  
  47. destanim=READLN(DestList)
  48. say "Creating animation:" destanim
  49.  
  50. sourceanim=READLN(SourceList)
  51. say "Source animation:" sourceanim
  52. 'LoadBuffer 'sourceanim' force Frame' 0
  53. if rc=0 then do
  54.   say "Source is no suitable animation file!"
  55.   address command 'wait 5'
  56.   exit
  57. end
  58.  
  59. frame=1
  60. DO FOREVER
  61.   say "Processing frame" frame
  62.   'LoadBuffer 'sourceanim' force Frame' frame
  63.   if rc~=0 then exit
  64.   'GetMain'
  65.   if rc~=0 then exit
  66.   parse var result '"' bufname '"' xdim ydim more
  67.   if (frame=1) then say "Size:" xdim ydim
  68.   scalefac=min(36000/xdim,31000/ydim)
  69.   if (scalefac<100) then do
  70.      say "Downscaling:" scalefac||"%"
  71.      'Scale 'scalefac scalefac ' percent'
  72.      if rc~=0 then do
  73.         say "Scaling failed!"
  74.         exit
  75.      end
  76.   end
  77.  
  78.   'SaveBufferAs Format "-HHsYUVSq animation-" File 'destanim
  79.   if rc~=0 then exit
  80.   frame=frame+1
  81. END
  82.  
  83.